/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package google;

/**
 *
 * @author nisarg
 */
public class t9_spelling {
    
    public static void main(String[] args) {
        String msg = "jasmine";
        String seq = "";
        char c = msg.charAt(0);
        int key = 0,times = 0;
        int bit = 0;
        int j = 0;
        int key1 = 0;
        char final1 = 'a';
        int flag = 0,s = 0;
        while(j < msg.length()) {
            c = msg.charAt(j++);
            if(c==115) bit = 1;
            if(c>=115 && c<119) {
                //bit = 1;
                c--;
            }
            if(c>=119 && c<122) {
                //bit = 2;
                c--;
            }
            if(c==122) {
                bit = 1;
                c-=2;
            }
            //System.out.println("c = " + c);
            key = ((c-97)/3) + 2;
            times = c%3;
            int i = 0;
            if(times == 0 ) i = 3;
            else i = times;
            i+=bit;
            bit = 0;
            while(i>0) {
                System.out.print(key);
                i--;
            }
            //System.out.print(" ");
            int times1 = 0;
            
            if(flag == 0) {
                s = 2;
                flag = 1;
            }
            else s = 2;
            if((j-s)>=0) {
                c = msg.charAt(j-s);
                final1 = c;
                /*###########################################################################*/
                if(c>=115 && c<119) {
                    c--;
                    }
                if(c>=119 && c<122) {
                    c--;
                    //System.out.println("Y");
                }
                if(c==122) {
                    //System.out.println("U");
                    bit = 1;
                    c-=2;
                    //System.out.println("Here");
                }
                /*###########################################################################*/
                //System.out.println("c1 = " + c);
                key1 = ((c-97)/3) + 2;
                times1 = c%3;
                //System.out.println("key1 = " + key1 + ", key" + key);
                if(key1==key) {
                    System.out.print(" ");
                    //System.out.println("key1 = " + key1 + " key = " + key);
                }
                
                //System.out.println("key = " + key + " key1 = " + key1);
                
            }
            //System.out.println("final1 = " + final1);
        }
    }
}
